package com.enqualcomm.kids.activities;

import android.content.Intent;
import android.os.Build;
import android.view.WindowManager;
import android.widget.TextView;

import com.enqualcomm.kids.BuildConfig;
import com.enqualcomm.kids.R;
import com.enqualcomm.kids.base.BaseActivity;
import com.enqualcomm.kids.config.userdefault.UserTerminalDefault;
import com.enqualcomm.kids.network.socket.response.QueryUserTerminalInfoResult;
import com.enqualcomm.kids.network.socket.response.TerminallistResult;
import com.enqualcomm.kids.view.CircleImageView;


import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import common.utils.MyFrontUtil;


/**
 * Created by Sunzhigang on 2016/2/24.
 * 艾知识界面
 */
@EActivity(R.layout.activity_childqa)
public class ChildQAActivity extends BaseActivity {
    TerminallistResult.Terminal terminal;


    @ViewById(R.id.title_bar_title_tv)
    TextView title_bar_title_tv;
    @ViewById(R.id.title_bar_terminal_icon_iv)
    CircleImageView title_bar_terminal_icon_iv;

    @AfterViews
    void setupView() {
        terminal = getTerminal();
        initTitle();
    }

    private void initTitle() {
//        findViewById(R.id.top_layout).setBackgroundResource(R.color.colorPrimary);
        QueryUserTerminalInfoResult.Data info = new UserTerminalDefault(terminal.userterminalid).getInfo();
        if ("科乐-科乐+".equals(BuildConfig.CHANNEL)){
            setupTitleIcon(info, terminal.terminalid, terminal.userterminalid, getString(R.string.kele_aizhishi_title));
        }else {
            setupTitleIcon(info, terminal.terminalid, terminal.userterminalid, getString(R.string.aizhishi_title));
            TextView title_terminal_name_tv = (TextView) findViewById(R.id.title_bar_terminal_name_tv);
            MyFrontUtil.initTextViewText(this,title_terminal_name_tv,info.name,"和","知识问答",1,info.name.length()+1);
        }

    }

    @Click(R.id.title_bar_left_iv)
    void goback() {
        finish();
    }

    @Click(R.id.xueling_qian_ibn)
    void startEasyMode() {
        Intent intent = new Intent(this, ChildQuestionActivity_.class);
        intent.putExtra("terminal", terminal);
        intent.putExtra("defcult", "0");
        startActivity(intent);
    }

    @Click(R.id.xueling_hou_ibn)
    void startDefaultMode() {
        Intent intent = new Intent(this, ChildQuestionActivity_.class);
        intent.putExtra("terminal", terminal);
        intent.putExtra("defcult", "1");
        startActivity(intent);
    }
}
